/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package rg1guidemo;

import java.awt.GridLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.GroupLayout;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JTextField;

/**
 *
 * @author apple
 */
public class GridFrame extends JFrame 
{
    private JButton button1;
    private JButton button2;
    private JButton button3;
    private JButton button4;
    private JButton button5;
    private JButton button6;
    private JPanel panel1;
    private JButton button7;
    private JButton button8;
    private JTextField textField1;

    public GridFrame() {
        this.setBounds(400, 300, 600, 400);
        this.setDefaultCloseOperation(EXIT_ON_CLOSE);
        
        button1=new JButton("Button1");
        button2=new JButton("Button2");
        button3=new JButton("Button3");
        button4=new JButton("Button4");
        button5=new JButton("Button5");
        button6=new JButton("Button6");
        panel1=new JPanel();
        button7=new JButton("Button7");
        button8=new JButton("Button8");
        
        this.add(button1);
        this.add(button2);
        this.add(button3);
        this.add(button4);
        this.add(button5);
        this.add(panel1);
        
        this.setLayout(new GridLayout(2, 3));
        textField1=new JTextField();
        panel1.add(textField1);
        panel1.add(button6);
        panel1.add(button7);
        panel1.add(button8);
        panel1.setLayout(new GridLayout(4, 1));
        
        button1.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
               textField1.setText("AAA");
            }
        });
        button2.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                textField1.setText("BBB");
            }
        });
        button3.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                textField1.setText("CCC");
            }
        });
    }

    
    
    
    
    
    }
